//
//  LSFooterView.swift
//  新浪微博---01次
//
//  Created by 李宗帅 on 16/5/7.
//  Copyright © 2016年 LS. All rights reserved.
//

import UIKit

class LSFooterView: UIView {
    
    var footerViewModel:LSStatusViewModel?{
        didSet{
           //如果转发数量为0 那么久显示文字转发  否则显示数量 双引号打印变量
            retweetButton.setTitle(footerViewModel?.reposts_String, forState: UIControlState.Normal)
            
            commentButton.setTitle(footerViewModel?.comments_sting, forState: UIControlState.Normal)
            
            goodButton.setTitle(footerViewModel?.goods_Sting, forState: UIControlState.Normal)
        }
    }

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }


    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    private func setupUI(){
        
        addSubview(retweetButton)
        addSubview(commentButton)
        addSubview(goodButton)
        
        
        retweetButton.snp_makeConstraints { (make) -> Void in
            make.bottom.top.left.equalTo(self)
            
            make.right.equalTo(commentButton.snp_left)
            
            make.width.equalTo(commentButton.snp_width)

        }
        
        commentButton.snp_makeConstraints { (make) -> Void in
            make.top.bottom.equalTo(self)
            
            
            make.right.equalTo(goodButton.snp_left)
            
            make.width.equalTo(goodButton)

        }
        
        goodButton.snp_makeConstraints { (make) -> Void in
            make.top.bottom.right.equalTo(self)
        }
    }
    
    //MARK:--懒加载控件
    private lazy var retweetButton:UIButton = UIButton(title: "转发", image: "timeline_icon_retweet", color: UIColor.darkGrayColor(), font: 16)
    private lazy var commentButton:UIButton = UIButton(title: "评论", image: "timeline_icon_comment", color: UIColor.darkGrayColor(), font: 16)
    private lazy var goodButton:UIButton = UIButton(title: "赞", image: "timeline_icon_like", color: UIColor.darkGrayColor(), font: 16)
}
